<h1>添加角色</h1>
<% form_for([:admin , @role],:html=>{:class => "form"}) do |f| %>
  <%= f.error_messages %>

  <table class="table">
    <tbody>
      <tr class="odd">
        <td width="60px">名称</td>
        <td width="200px">    <%= f.text_field :name %></td>
        <td width="60px">描述</td>
        <td width="200px"> <%= f.text_field :description %></td>
        <td width=""> </td>
      </tr>
      <tr class="odd">
        <td width="60px"><%= '权限'  %></td>
        <td width="200px" colspan="3">     <%Permission.all.each do |permission|%>
            <label style="display:block;width:250px;float:left;height:19px;"><%= check_box_tag "role[permission_ids][]", permission.id, @role.permissions.include?(permission) %>
            <%= permission.name %> <%= permission.description %></label>
          <%end%></td>
        <td width=""> </td>
      </tr>
      <tr class="odd">
        <td width="60px"></td>
        <td width="200px"> </td>
        <td width="60px"></td>
        <td width="200px">  <%= f.submit 'Create' ,:class => 'button'%></td>
        <td width=""> </td>
      </tr>
    </tbody>
  </table>
<% end %>

<%= link_to '返回', admin_roles_path %>